home *** CD-ROM | disk | FTP | other *** search
- package STC9.Math
- {
- import flash.geom.Point;
-
- public class CLineIntersection
- {
-
- private static var nPrecision:Number = 0.000001;
-
-
- public function CLineIntersection()
- {
- super();
- }
-
- public static function InfinatePD(param1:Point, param2:Point, param3:Point, param4:Point) : Point
- {
- var _loc5_:Number = NaN;
- var _loc6_:Number = NaN;
- §§push(param4.x * param2.y);
- §§push(param2.x * param4.y);
- if(true)
- {
- _loc5_ = §§pop() - §§pop();
- if(Math.abs(_loc5_) < nPrecision)
- {
- return undefined;
- }
- §§push(param4.y * (param1.x - param3.x) - param4.x * (param1.y - param3.y));
- §§push(_loc5_);
- }
- _loc6_ = §§pop() / §§pop();
- return new Point(param1.x + _loc6_ * param2.x,param1.y + _loc6_ * param2.y);
- }
-
- public static function SegmentPD(param1:Point, param2:Point, param3:Point, param4:Point) : Point
- {
- var _loc5_:Number = NaN;
- var _loc6_:Number = NaN;
- var _loc7_:Number = NaN;
- var _loc8_:Number = NaN;
- if(true)
- {
- _loc5_ = param4.x * param2.y - param2.x * param4.y;
- if(true)
- {
- if(Math.abs(_loc5_) < nPrecision)
- {
- if(true)
- {
- return undefined;
- }
- addr115:
- §§push(_loc8_ <= 1);
- }
- else
- {
- _loc6_ = param2.x * param4.y - param4.x * param2.y;
- _loc7_ = (param4.y * (param1.x - param3.x) - param4.x * (param1.y - param3.y)) / _loc5_;
- §§push((_loc8_ = (param2.x * (param1.y - param3.y) - param2.y * (param1.x - param3.x)) / _loc6_) >= 0);
- if(true)
- {
- if(§§pop())
- {
- §§pop();
- §§goto(addr115);
- }
- }
- }
- if(§§pop())
- {
- return new Point(param1.x + _loc7_ * param2.x,param1.y + _loc7_ * param2.y);
- addr121:
- }
- }
- return undefined;
- }
- §§goto(addr121);
- }
-
- public function toString() : String
- {
- return _CLASSID_;
- }
-
- public function get _CLASSID_() : String
- {
- return "CLineIntersection";
- }
-
- public function get _BASECLASSID_() : String
- {
- return "CLineIntersection";
- }
- }
- }
-